This forum is closed to new posts and
responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:
RE: How to refresh field using script - back end processing ~Umberto Nongeroson 20.Jan.04 03:42 PM a Web browser Applications Development 6.0.2 CF2Windows XP
Your script doesn't make any sense. First you obtain a back end document, then you obtain the front end document, refresh it, save it, then compute the form on the back end document.
Set NowDoc = ListView.GetFirstDocument() While Not NowDoc Is Nothing Set uidoc = workspace.CurrentDocument Call uidoc.Refresh Call uidoc.Save Call NowDoc.ComputeWithForm(True, False) Call NowDoc.Save(True, True) Set NowDoc = ListView.GetNextDocument(NowDoc) Wend
A script to compute the form on all the documents in a folder would look like this:
dim s as notessession
dim db as notesdatabase, folder as notesview, d as notesdocument, flag as integer
set s = notessession
set db = s.currentdatabase
set folder = db.getview("foo")
set d = folder.getfirstdocument
do while not (d is nothing)
flag = d.computewithform(false,false)
if flag then
call d.save(false,false)
else
' hande this error here
end if
set d = folder.getnextdocument(d)
loop
Be advised that computewithform is a very resource intensive method. If you need to run it on a lrge number of documents you should create a simplified copy of your form, one that contains just those fields that need to be recomputed, and then do this:
do while not (d is nothing)
d.Form="SimplifiedForm"
flag = d.computewithform(false,false)
if flag then
d.Form="TheRealForm"
call d.save(false,false)
else
' hande this error here
end if
set d = folder.getnextdocument(d)
loop
If that's still too processor intensive you should stop using computewithform and do the job with script alone.